package de.fuberlin.inf.alp3.ue09.a2;

interface Graph {
    void add (int a, int b, float w) throws IllegalArgumentException;
    Path shortestPath(int a, int b) throws IllegalArgumentException;
    class Path {
        int[] path;
        float cost;
        @Override
        public String toString() {
            StringBuffer sb = new StringBuffer();
            for (int i : path) {
                sb.append('[');
                sb.append(i+1);
                sb.append("] => ");
            }
            sb.delete(sb.length() - 4, sb.length() - 1);
            sb.append("(costs: ");
            sb.append(cost);
            sb.append(')');
            return sb.toString();
        }
        public Path(int a, int b, float c) {
            this.path = new int[2];
            this.path[0] = a;
            this.path[1] = b;
            this.cost = c;
        }
        public Path(int[] p, float c) {
            this.path = p;
            this.cost = c;
        }
    }
}